package binpacking.model;

public class Block implements Comparable{
	
	private int size; // size of this block
	private boolean placed; // has the block been placed in a bin
	
	public Block(int size) {
		this.size = size;
		this.placed = false;
	}

	public int getSize() {
		return size;
	}

	public boolean isPlaced() {
		return placed;
	}

	public void setPlaced( boolean placed ) {
		this.placed = placed;
	}
	
	public void place() {
		this.placed = true;
	}

	@Override
	public int compareTo(Object o) {
		Block block = (Block)o;
		
		if(this.size < block.getSize()) {
			return -1;
		}
		else if(this.size == block.getSize()) {
			return 0;
		}
		else {
			return 1;
		}
	}
}
